import { FileItem } from '@arco-design/web-vue';
import { TotalScore } from '@/types/game-score';
import { CommonObj } from './global';
import { CourseItem } from './course';
import { OperatorItem } from './operators';
import { User } from './user';

export interface GameRuleItem {
  title: string;
  content: string;
}

export interface GameRule {
  id: number;
  ruleTitle: string;
  ruleDetail: string;
  gmtCreate: string;
}

export interface GameDetailSectionItem {
  title: string;
  content: string;
}

export interface GameScheduleItem {
  range: string[];
  content: string;
}

export interface GameProduct {
  id?: string;
  name: string;
  rmbPrice?: number;
  description: string;
  mustPay: boolean;
  disabled: boolean;
  productGroupId?: string;
  gameId?: string;
  sortNo?: number;
}

export interface GameProductGroup {
  id?: string;
  name: string;
  minProductChoose: number;
  maxProductChoose: number;
  gameId?: string;
  description: string;
  sortNo?: number;
  products: GameProduct[];
}

export interface Game extends CommonObj {
  id: string;
  name: string;
  logo: string;
  course?: CourseItem;
  operator?: OperatorItem;
  logoFileList?: FileItem[];
  gameType?: number;
  parentGame?: Game;
  parentId?: string;
  pics: string;
  picsFileList?: FileItem[];
  detailPics: string;
  detailPicsFileList?: FileItem[];
  signShareImage?: string;
  signShareImageFileList?: FileItem[];
  signShareColor?: string;
  shareImage?: string;
  shareImageFileList?: FileItem[];
  regionLevel: number;
  rankLevel: number;
  kickoffType: number;
  kickoffTime: string;
  rewardTip: string;
  sponsors: string;
  type: number;
  groupType: number;
  province: string;
  city: string;
  signRange?: string[];
  signStartDate: string;
  signEndDate: string;
  signConditionMinPar: number;
  signConditionMaxPar: number;
  payItems: string;
  caddieFee: number;
  caddieTip: string;
  scheduleItems: string;
  scheduleList: GameScheduleItem[];
  detailSections: string;
  detailSectionList?: GameDetailSectionItem[];
  range?: string[];
  startDate: string;
  endDate: string;
  publicDate: string;
  detail: string;
  uvCount: number;
  pvCount: number;
  courseId: string;
  cupId: string;
  operatorId: string;
  maxPlayerCount: number;
  payWay: number;
  payMethod: number;
  themeColor: string;
  rmbPrice: number;
  rmbDiscount: number;
  pointPrice: number;
  gameProductGroupVOS?: GameProductGroup[];
  approveState: number;
  state: number;
  createFrom: number;
  creatorId: string;
  approveUserId: string;
  refuseReason?: string;
  testGame?: number;
  creator?: {
    nickname: string;
  };
  approveUser?: {
    nickname: string;
  };
  copyFromGameId?: string;
  canTeacherSign?: number;
  childGameCount?: number;
  scoreType?: number;
}

export interface GameSearchParams {
  name?: string;
  regionLevel?: number;
  type?: number;
  groupType?: number;
  province?: string;
  city?: string;
  signStartRange?: string[];
  signStartDate?: string;
  signEndRange?: string[];
  signEndDate?: string;
  startRange?: string[];
  startDate?: string;
  endRange?: string[];
  endDate?: string;
  courseId?: string;
  operatorId?: string;
  approveState?: number;
  approveStates?: number[];
  state?: number;
  states?: number[];
  createFrom?: number;
  testGame?: number;
}

export interface GameGroup extends CommonObj {
  gameId: string;
  groupName: string;
  id: string;
  userIds: string[];
  users: User[];
  startTime: string;
}

export interface UserGame extends CommonObj {
  state: number;
  sign: number;
  gameId: string;
  gameDetailVO: Game;
}

export interface GamePlay {
  id: number;
  name: string;
}

export interface GamePlayResult {
  id: number;
  name: string;
  gameId: string;
  playId: number;
  userType: number;
  calType: number;
  groupBy: number;
  teamPlayerCount: number;
  teamBy: number;
  withUnreal: number;
  enrollType?: number;
  sex?: number;
  result?: string;
}

export interface GameEnrollType {
  id: number;
  gameId: string;
  name: string;
}

export interface GameUserMatch {
  matchTag: string;
  gameId: string;
  game?: Game;
  users: User[];
}

export interface GameSignImportItem {
  isSuccess: boolean;
  lineIndex: number;
  failReason: string;
}

export interface GameRankScoreItem {
  user: User;
  rankIndex: number;
  score: number;
  gameTotalScore: TotalScore;
}

export interface GameRankDataGroup {
  gameId: string;
  groupName: string;
  scoreItemVOList: GameRankScoreItem[];
}

export interface IHandicapRankUser {
  id: number;
  year: string;
  userId: string;
  user: User;
  gameId: string;
  courseId: string;
  cupId: string;
  rankIndex: number;
  score: number;
  gameTime: string;
}

export interface HandicapTotalScoreRankUser extends IHandicapRankUser {
  handicapDiff: number;
  handicapScore: number;
  bestPar: number;
  totalPar: number;
  groupType: string;
}

export interface HandicapPureSoreRankUser extends IHandicapRankUser {
  handicapDiff: string;
  slopeRating: number;
  purePar: number;
  handicapPureScore: number;
}
